package com.syf.kit.soa.core.send.protocol;

import com.syf.kit.soa.core.SyfRpcMsg;
import com.syf.kit.soa.core.SyfSOAProtocolCont;

import java.util.UUID;

/**
 * 心跳报文创建器
 */
public class BeatRpcMsgBuilder {
    private static SyfRpcMsg beat;

    public static SyfRpcMsg build(String magicNum) {
        if (beat == null) {
            UUID uuid = UUID.randomUUID();
            long reqUUID = uuid.getLeastSignificantBits();
            beat = new SyfRpcMsg(magicNum, "01", SyfSOAProtocolCont.BEAT_REQ_TYPE, SyfSOAProtocolCont.JSON_BIZ_DATA_TYPE
                    , 0, reqUUID, "1234567890", new byte[4], "ping");
        }
        return beat;
    }
}
